<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>收货预定看板</title>
    <link rel="stylesheet" href="/3nod_web/layui/css/layui.css" media="all">
</head>
<body>
<div id="content">
    <h1>收货预定看板</h1>
    <table class="layui-hide" id="demo" lay-filter="demo"></table>
</div>


<script src="/3nod_web/layui/layui.js" charset="utf-8"></script>
<script src="/3nod_web/js/jquery-1.8.3.js" charset="utf-8"></script>
<script>

    layui.use('table', function () {
        var table = layui.table;

        //方法级渲染
        table.render({
            elem: '#demo'
            , url: '/3nod_web/report/receivingBoardList/'
            , cols: [
                [
                    {field: 'storerkey', title: '据点', sort: true, fixed: true,width:80}
                    , {field: 'receiptKey', title: '送货单号',width:150}
                    , {field: 'voucherType', title: '单据类型',width:120}
                    , {field: 'deliveryDate', title: '送货日期',width:150}
                    , {field: 'sku', title: '品号',width:130}
                    , {field: 'descr', title: '品名',width:130}
                    // , {field: 'specification', title: '规格'}
                    // , {field: 'supplierCode', title: '供应商代码'}
                    , {field: 'supplierShort', title: '供应商简称',width:150}
                    , {field: 'goodsQuantity', title: '计划收货数量',width:150}
                    , {field: 'unit', title: '单位',width:60}
                    , {field: 'volume', title: '体积(KG)',width:100}
                    , {field: 'purchaseOrder', title: '采购订单',width:150}
                    // , {field: 'purchaseItems', title: '采购项次'}
                    , {field: 'receiptStatus', title: '收货状态',width:90}
                    , {field: 'delayTime', title: '延期时间(天)',width:150}
                ]
            ]
            , height: 'full-90'
        })
    });
    scrollBar();

    function scrollBar() {
        var height = 0;
        $.get("/3nod_web/report/receivingBoardList/", function (data) {
            height = $(".layui-table").height() * data.count;
        });
        var number = 0;
        var length = 0;
        var time = setInterval(function () {
            number += 1;
            if (number == 12) {
                clearInterval(time);
                $('.layui-table-body').scrollTop('0');
            } else {
                length += height / 11;
                $('.layui-table-body').scrollTop(length);  //只有此处有区别
            }
        }, 1000 * 60 * 10);
    }

    setInterval(function () {
        scrollBar()
    }, 13000 * 60 * 10);

    //十秒刷新一次
    // window.reloadView = function () {
    //     //获取滚动的时间
    //     $.get("/3nod_web/test/getTime", function (data) {
    //         // ins.reload({interval: time});
    //         $("#time").val(data);
    //     });
    // };
    // setInterval('reloadView()', 5);

    setInterval(function () {
        location.reload()
    }, 24000 * 60 * 10);
</script>

</body>
</html>